package com.hmall.cart.controller.inner;

import com.hmall.cart.service.ICartService;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * TODO
 *
 * @Author haoye
 * @Date 2025/11/12 16:23
 */
@RestController("cartInnerController")
@RequestMapping("/carts/inner")
public class CartController {

    @Autowired
    private ICartService cartService;

    @ApiOperation("批量删除购物车中商品")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "userId", value = "用户id"),
            @ApiImplicitParam(name = "ids", value = "购物车条目id集合")
    })
    @DeleteMapping
    public void deleteCartItemByIds(@RequestParam("ids") List<Long> ids, @RequestParam("userId") Long userId){
        cartService.removeByItemIds(ids, userId);
    }
}
